//
//  SaveViewController.m
//  Fragrance
//
//  Created by yinzhongyuan on 15/5/30.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "SaveViewController.h"
#import "CftModelData.h"

@interface SaveViewController ()

@end

@implementation SaveViewController


- (void)viewDidLoad {
    [super viewDidLoad];

   
   
    saveTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64) style:UITableViewStylePlain];
    saveTableView.delegate = self;
    saveTableView.dataSource = self;

    saveTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    [self.view addSubview:saveTableView];
        [saveTableView release];


}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifer = @"cell";
    SaveTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifer];
    if (cell == nil ) {
        cell = [[SaveTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifer];
    }
    
    model = [self.arr objectAtIndex:indexPath.row];

    cell.saveLabel.text = model.name;
    cell.describeLabel.text = model.desc;
    cell.selectionStyle  = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor colorWithRed:234 / 255.0 green:114 / 255.0 blue:0 / 255.0 alpha:0.5];
    return cell;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.arr.count;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath

{
    model = [self.arr objectAtIndex:indexPath.row];
    CGFloat hight = [AutoHeight getLabelHight:15.0 :self.view.frame.size.width - 70 :model.desc];
    return 150 + hight - 50;
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
